<?php 
require  './configs/config.php';


function mvc_autoload($classname)
{
	if(file_exists("./models/{$classname}.class.php")) {
		require "./models/{$classname}.class.php";
	} else if(file_exists("./controllers/{$classname}.php")) {
		require "./controllers/{$classname}.php";
	}else {
		header("HTTP/1.0 404NOT found");
		echo '<h1>404 NOT FOUND</h1>';
		exit;
	}
}

require './libs/Smarty.class.php';
spl_autoload_register('mvc_autoload');
//$smarty = new Smarty();



$c =(!empty($_GET['c']))?$_GET['c']:'Index';

$a =(!empty($_GET['a']))?$_GET['a']:'index';

$classname = $c.'Controller';
$controller = new $classname();
$controller->$a();